Move hypervisor.h to asm-i386/asm-x86_64.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 14 Sep 2005 09:17:44 +0000 (09:17 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 14 Sep 2005 09:17:44 +0000 (09:17 +0000)
Signed-off-by: Keir Fraser <keir@xensource.com>
29 files changed:
linux-2.6-xen-sparse/arch/xen/i386/kernel/cpu/common.c
linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c
linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c
linux-2.6-xen-sparse/arch/xen/i386/mm/init.c
linux-2.6-xen-sparse/arch/xen/i386/mm/pgtable.c
linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c
linux-2.6-xen-sparse/arch/xen/kernel/reboot.c
linux-2.6-xen-sparse/arch/xen/kernel/skbuff.c
linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup.c
linux-2.6-xen-sparse/arch/xen/x86_64/kernel/setup64.c
linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c
linux-2.6-xen-sparse/drivers/xen/blkback/common.h
linux-2.6-xen-sparse/drivers/xen/blkfront/block.h
linux-2.6-xen-sparse/drivers/xen/blktap/blktap.h
linux-2.6-xen-sparse/drivers/xen/blktap/common.h
linux-2.6-xen-sparse/drivers/xen/console/console.c
linux-2.6-xen-sparse/drivers/xen/console/xencons_ring.c
linux-2.6-xen-sparse/drivers/xen/usbback/common.h
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_comms.c
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
linux-2.6-xen-sparse/include/asm-xen/asm-i386/hypervisor.h [new file with mode: 0644]
linux-2.6-xen-sparse/include/asm-xen/asm-i386/pgtable.h
linux-2.6-xen-sparse/include/asm-xen/asm-i386/system.h
linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hypervisor.h [new file with mode: 0644]
linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/pgtable.h
linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/system.h
linux-2.6-xen-sparse/include/asm-xen/evtchn.h
linux-2.6-xen-sparse/include/asm-xen/gnttab.h
linux-2.6-xen-sparse/include/asm-xen/hypervisor.h [deleted file]

index 31ded2cf5803f9b078c2f0bd8ab052dddeb79490..861c2d2f62997b53913b043703b25ae6237d77e7 100644 (file)
@@ -15,7 +15,7 @@
 #include <asm/apic.h>
 #include <mach_apic.h>
 #endif
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 
 #include "cpu.h"
 
index 1855042fa09c8ad07f97bd614b65c7b3134845d6..7915b4f39496ee9c3a24cd30a3b58152129fc76d 100644 (file)
@@ -53,7 +53,7 @@
 #include <asm/io_apic.h>
 #include <asm/ist.h>
 #include <asm/io.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #include <asm-xen/xen-public/physdev.h>
 #include <asm-xen/xen-public/memory.h>
 #include "setup_arch_pre.h"
index 7332d2f9afefb4a94c52048d925bfab7f928149a..1b20354c9725002f624c097e8c15649751fb151c 100644 (file)
@@ -33,7 +33,7 @@
 #include <linux/vmalloc.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #include <asm-xen/balloon.h>
 #include <asm-xen/xen-public/memory.h>
 #include <linux/module.h>
index 4ef646b3fea4fe7f46a7417707fdae1aea6794ce..b5f700501251591b9867eaa89c1b68fcfae89185 100644 (file)
@@ -39,7 +39,7 @@
 #include <asm/tlb.h>
 #include <asm/tlbflush.h>
 #include <asm/sections.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 
 extern unsigned long *contiguous_bitmap;
 
index e46d69df0db7e3b1733c8db1152da5274703d661..503d48842ab7cc43f9e62e1567d7e0ae80859c3b 100644 (file)
@@ -25,7 +25,7 @@
 #include <asm/mmu_context.h>
 
 #include <asm-xen/foreign_page.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 
 void show_mem(void)
 {
index 5926bcf99efbe71806643f785a96558c29402347..42508d78fdb6e109201d08117af97b1d94de0397 100644 (file)
@@ -40,7 +40,7 @@
 #include <asm/synch_bitops.h>
 #include <asm-xen/xen-public/event_channel.h>
 #include <asm-xen/xen-public/physdev.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #include <asm-xen/evtchn.h>
 
 /*
index 12c7610e90a13d15a9e2876a783372f9d6025881..7a8842630b6fd3251e555f2de64b938f35c4590f 100644 (file)
@@ -10,7 +10,7 @@
 #include <asm/irq.h>
 #include <asm/mmu_context.h>
 #include <asm-xen/evtchn.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #include <asm-xen/xen-public/dom0_ops.h>
 #include <asm-xen/queues.h>
 #include <asm-xen/xenbus.h>
index a7fe1519f63e2ee5deaaac6f561a0391bd9de38d..1a1d1131867bd884d95a3ef47722841b7ec1d4c2 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/init.h>
 #include <asm/io.h>
 #include <asm/page.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 
 /* Referenced in netback.c. */
 /*static*/ kmem_cache_t *skbuff_cachep;
index 9b3d47b29cf09845735e160b31b1c3cea93bb478..cb0ffc9e51ff02f13b913e8b25b5fef522b497e9 100644 (file)
@@ -61,7 +61,7 @@
 #include <linux/percpu.h>
 #include <asm-xen/xen-public/physdev.h>
 #include "setup_arch_pre.h"
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #define PFN_UP(x)       (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
 #define PFN_PHYS(x)     ((x) << PAGE_SHIFT)
 #define end_pfn_map end_pfn
index 6d2e43d67e6196313cfc372ba318b79f615e48b9..fc8eff4402f8deef9f9194133ac8ed3cafd659db 100644 (file)
@@ -31,7 +31,7 @@
 #include <asm/mman.h>
 #include <asm/numa.h>
 #ifdef CONFIG_XEN
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #endif
 char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
 
index 8887c69e734199e33123d2fbe6bb6858225f0495..521252c8cec5965ba49916d3142bd7d1ddb0bc6a 100644 (file)
@@ -42,7 +42,7 @@
 #include <linux/highmem.h>
 #include <linux/vmalloc.h>
 #include <asm-xen/xen_proc.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #include <asm-xen/balloon.h>
 #include <asm-xen/xen-public/memory.h>
 #include <asm/pgalloc.h>
index 784fd9a020169d862c852ccf35c24eb2614d0ee8..fe09f200806228191d1be3fc15edcd6d921ef58a 100644 (file)
@@ -13,7 +13,7 @@
 #include <asm/setup.h>
 #include <asm/pgalloc.h>
 #include <asm-xen/evtchn.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #include <asm-xen/xen-public/io/blkif.h>
 #include <asm-xen/xen-public/io/ring.h>
 #include <asm-xen/gnttab.h>
index 8a2acd604661951f6ffef277d8d75d6d12f69196..f2eb0036e5378adcb904b59637f9c2f1603a822d 100644 (file)
@@ -45,7 +45,7 @@
 #include <linux/blkdev.h>
 #include <linux/major.h>
 #include <linux/devfs_fs_kernel.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #include <asm-xen/xenbus.h>
 #include <asm-xen/xen-public/xen.h>
 #include <asm-xen/xen-public/io/blkif.h>
index fb6be0e0e40d50f8eba057f0262dd8b3f97bdb07..7bc92ab2b0e2321d211bed23fefedd93f508ec64 100644 (file)
@@ -20,7 +20,7 @@
 #include <asm/io.h>
 #include <asm/setup.h>
 #include <asm/pgalloc.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #include <asm-xen/xen-public/io/blkif.h>
 #include <asm-xen/xen-public/io/ring.h>
 
index 3239a17d6be37c3d18b934b368dcd1ccf60f9189..bed5ee1a3f3053cae007624bffd64974c88370b4 100644 (file)
@@ -13,7 +13,7 @@
 #include <asm/setup.h>
 #include <asm/pgalloc.h>
 #include <asm-xen/evtchn.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #include <asm-xen/xen-public/io/blkif.h>
 #include <asm-xen/xen-public/io/ring.h>
 #include <asm-xen/gnttab.h>
index 18ed52c038e9af11712edfdab074b23c2385b915..1091c6f903a3aaffe78e41f57b0e042eccd5cffd 100644 (file)
@@ -50,7 +50,7 @@
 #include <asm/irq.h>
 #include <asm/uaccess.h>
 #include <asm-xen/xen-public/event_channel.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #include <asm-xen/evtchn.h>
 
 #include "xencons_ring.h"
index eb205ee37759d3efd156caea051df6ab338acaf1..154b0c735494e411abd4e68462b693e3176dc127 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/mm.h>
 #include <linux/slab.h>
 
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #include <asm-xen/evtchn.h>
 #include <linux/wait.h>
 #include <linux/interrupt.h>
index 56b3bc31df22f63d9138b42d8da8a4f6d669c13d..b7799ed8953ae06acabdad07aab4a532b1dba280 100644 (file)
@@ -12,7 +12,7 @@
 #include <asm/io.h>
 #include <asm/setup.h>
 #include <asm/pgalloc.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 
 #include <asm-xen/xen-public/io/usbif.h>
 
index 3626d1086e527dab5b11e384136ecdd27fc963d4..1543959df72d1c4746ac3ffeadbebdddbce745e7 100644 (file)
@@ -27,7 +27,7 @@
  * IN THE SOFTWARE.
  */
 
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #include <asm-xen/evtchn.h>
 #include <linux/wait.h>
 #include <linux/interrupt.h>
index 47e4fba82f2ae43a9a3fb4a6c07c2ab199e1aae4..f18900360bb0ac3242274c7d0df9c0ba13a9a5cf 100644 (file)
@@ -27,7 +27,7 @@
  */
 #define DEBUG
 
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #include <asm-xen/xenbus.h>
 #include <asm-xen/balloon.h>
 #include <linux/kernel.h>
diff --git a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/hypervisor.h b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/hypervisor.h
new file mode 100644 (file)
index 0000000..3c7a427
--- /dev/null
@@ -0,0 +1,189 @@
+/******************************************************************************
+ * hypervisor.h
+ * 
+ * Linux-specific hypervisor handling.
+ * 
+ * Copyright (c) 2002-2004, K A Fraser
+ * 
+ * This file may be distributed separately from the Linux kernel, or
+ * incorporated into other software packages, subject to the following license:
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this source file (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy, modify,
+ * merge, publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#ifndef __HYPERVISOR_H__
+#define __HYPERVISOR_H__
+
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/version.h>
+#include <asm-xen/xen-public/xen.h>
+#include <asm-xen/xen-public/dom0_ops.h>
+#include <asm-xen/xen-public/io/domain_controller.h>
+#include <asm/ptrace.h>
+#include <asm/page.h>
+#if defined(__i386__)
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+#  ifdef CONFIG_X86_PAE
+#   include <asm-generic/pgtable-nopud.h>
+#  else
+#   include <asm-generic/pgtable-nopmd.h>
+#  endif
+# else
+#  define pud_t pgd_t
+# endif
+#endif
+
+/* arch/xen/i386/kernel/setup.c */
+extern start_info_t *xen_start_info;
+
+/* arch/xen/kernel/evtchn.c */
+/* Force a proper event-channel callback from Xen. */
+void force_evtchn_callback(void);
+
+/* arch/xen/kernel/process.c */
+void xen_cpu_idle (void);
+
+/* arch/xen/i386/kernel/hypervisor.c */
+void do_hypervisor_callback(struct pt_regs *regs);
+
+/* arch/xen/i386/kernel/head.S */
+void lgdt_finish(void);
+
+/* arch/xen/i386/mm/hypervisor.c */
+/*
+ * NB. ptr values should be PHYSICAL, not MACHINE. 'vals' should be already
+ * be MACHINE addresses.
+ */
+
+void xen_pt_switch(unsigned long ptr);
+void xen_new_user_pt(unsigned long ptr); /* x86_64 only */
+void xen_load_gs(unsigned int selector); /* x86_64 only */
+void xen_tlb_flush(void);
+void xen_invlpg(unsigned long ptr);
+
+#ifndef CONFIG_XEN_SHADOW_MODE
+void xen_l1_entry_update(pte_t *ptr, pte_t val);
+void xen_l2_entry_update(pmd_t *ptr, pmd_t val);
+void xen_l3_entry_update(pud_t *ptr, pud_t val); /* x86_64/PAE */
+void xen_l4_entry_update(pgd_t *ptr, pgd_t val); /* x86_64 only */
+void xen_pgd_pin(unsigned long ptr);
+void xen_pgd_unpin(unsigned long ptr);
+void xen_pud_pin(unsigned long ptr); /* x86_64 only */
+void xen_pud_unpin(unsigned long ptr); /* x86_64 only */
+void xen_pmd_pin(unsigned long ptr); /* x86_64 only */
+void xen_pmd_unpin(unsigned long ptr); /* x86_64 only */
+void xen_pte_pin(unsigned long ptr);
+void xen_pte_unpin(unsigned long ptr);
+#else
+#define xen_l1_entry_update(_p, _v) set_pte((_p), (_v))
+#define xen_l2_entry_update(_p, _v) set_pgd((_p), (_v))
+#define xen_pgd_pin(_p)   ((void)0)
+#define xen_pgd_unpin(_p) ((void)0)
+#define xen_pte_pin(_p)   ((void)0)
+#define xen_pte_unpin(_p) ((void)0)
+#endif
+
+void xen_set_ldt(unsigned long ptr, unsigned long bytes);
+void xen_machphys_update(unsigned long mfn, unsigned long pfn);
+
+#ifdef CONFIG_SMP
+#include <linux/cpumask.h>
+void xen_tlb_flush_all(void);
+void xen_invlpg_all(unsigned long ptr);
+void xen_tlb_flush_mask(cpumask_t *mask);
+void xen_invlpg_mask(cpumask_t *mask, unsigned long ptr);
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+/* 
+** XXX SMH: 2.4 doesn't have percpu.h (or support SMP guests) so just 
+** include sufficient #defines to allow the below to build. 
+*/
+#define DEFINE_PER_CPU(type, name) \
+    __typeof__(type) per_cpu__##name
+
+#define per_cpu(var, cpu)           (*((void)cpu, &per_cpu__##var))
+#define __get_cpu_var(var)          per_cpu__##var
+#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
+
+#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
+#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
+#endif /* linux < 2.6.0 */
+
+void xen_create_contiguous_region(unsigned long vstart, unsigned int order);
+void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order);
+
+#include <asm/hypercall.h>
+
+#if defined(CONFIG_X86_64)
+#define MULTI_UVMFLAGS_INDEX 2
+#define MULTI_UVMDOMID_INDEX 3
+#else
+#define MULTI_UVMFLAGS_INDEX 3
+#define MULTI_UVMDOMID_INDEX 4
+#endif
+
+static inline void
+MULTI_update_va_mapping(
+    multicall_entry_t *mcl, unsigned long va,
+    pte_t new_val, unsigned long flags)
+{
+    mcl->op = __HYPERVISOR_update_va_mapping;
+    mcl->args[0] = va;
+#if defined(CONFIG_X86_64)
+    mcl->args[1] = new_val.pte;
+    mcl->args[2] = flags;
+#elif defined(CONFIG_X86_PAE)
+    mcl->args[1] = new_val.pte_low;
+    mcl->args[2] = new_val.pte_high;
+    mcl->args[3] = flags;
+#else
+    mcl->args[1] = new_val.pte_low;
+    mcl->args[2] = 0;
+    mcl->args[3] = flags;
+#endif
+}
+
+static inline void
+MULTI_update_va_mapping_otherdomain(
+    multicall_entry_t *mcl, unsigned long va,
+    pte_t new_val, unsigned long flags, domid_t domid)
+{
+    mcl->op = __HYPERVISOR_update_va_mapping_otherdomain;
+    mcl->args[0] = va;
+#if defined(CONFIG_X86_64)
+    mcl->args[1] = new_val.pte;
+    mcl->args[2] = flags;
+    mcl->args[3] = domid;
+#elif defined(CONFIG_X86_PAE)
+    mcl->args[1] = new_val.pte_low;
+    mcl->args[2] = new_val.pte_high;
+    mcl->args[3] = flags;
+    mcl->args[4] = domid;
+#else
+    mcl->args[1] = new_val.pte_low;
+    mcl->args[2] = 0;
+    mcl->args[3] = flags;
+    mcl->args[4] = domid;
+#endif
+}
+
+#endif /* __HYPERVISOR_H__ */
index 477999717774b9c6d584d0b4cb77e7e7f7f0c95f..1db7c0382edecb9e947a092210561224a36057b8 100644 (file)
@@ -2,7 +2,7 @@
 #define _I386_PGTABLE_H
 
 #include <linux/config.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 
 /*
  * The Linux memory management assumes a three-level page table setup. On
index 6c991e8058eb9b2cc05e76217326c921e69edaeb..a627fbf4fc72a892eddff44f55c86aef4edfebb9 100644 (file)
@@ -7,7 +7,7 @@
 #include <asm/synch_bitops.h>
 #include <asm/segment.h>
 #include <asm/cpufeature.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #include <asm/smp_alt.h>
 
 #ifdef __KERNEL__
diff --git a/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hypervisor.h b/linux-2.6-xen-sparse/include/asm-xen/asm-x86_64/hypervisor.h
new file mode 100644 (file)
index 0000000..dc3e5e5
--- /dev/null
@@ -0,0 +1,2 @@
+
+#include <asm-i386/hypervisor.h>
index 86f1b4f7fae7cb5785c226610a6c9a5d6d1cff93..d24c5c5299d727ef1d1baafda15a4de7485d147c 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/sched.h>
 #include <asm/pda.h>
 #ifdef CONFIG_XEN
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 
 extern pud_t level3_user_pgt[512];
 extern pud_t init_level4_user_pgt[];
index 518dcdf5a320c5ee5409a81016c00489f023b274..d06d1485ebe29802194bfb3724064bb2e3dc927f 100644 (file)
@@ -5,7 +5,7 @@
 #include <linux/kernel.h>
 #include <asm/segment.h>
 #include <asm/synch_bitops.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #include <asm-xen/xen-public/arch-x86_64.h>
 
 #ifdef __KERNEL__
index ff522a927e73c2d747f87e6656247e79fade8ad8..db40acaed94e0f7e1a66fb8226a71e4b9afaf4d2 100644 (file)
@@ -33,7 +33,7 @@
 
 #include <linux/config.h>
 #include <linux/interrupt.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #include <asm/ptrace.h>
 #include <asm/synch_bitops.h>
 #include <asm-xen/xen-public/event_channel.h>
index ab4871e66364d6749f036ee0ca08130b1f55725a..930eb034eabd4b73f38d94aab6b7d1fe885e5a82 100644 (file)
@@ -14,7 +14,7 @@
 #define __ASM_GNTTAB_H__
 
 #include <linux/config.h>
-#include <asm-xen/hypervisor.h>
+#include <asm/hypervisor.h>
 #include <asm-xen/xen-public/grant_table.h>
 
 /* NR_GRANT_FRAMES must be less than or equal to that configured in Xen */
diff --git a/linux-2.6-xen-sparse/include/asm-xen/hypervisor.h b/linux-2.6-xen-sparse/include/asm-xen/hypervisor.h
deleted file mode 100644 (file)
index 3c7a427..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/******************************************************************************
- * hypervisor.h
- * 
- * Linux-specific hypervisor handling.
- * 
- * Copyright (c) 2002-2004, K A Fraser
- * 
- * This file may be distributed separately from the Linux kernel, or
- * incorporated into other software packages, subject to the following license:
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this source file (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use, copy, modify,
- * merge, publish, distribute, sublicense, and/or sell copies of the Software,
- * and to permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- */
-
-#ifndef __HYPERVISOR_H__
-#define __HYPERVISOR_H__
-
-#include <linux/config.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/version.h>
-#include <asm-xen/xen-public/xen.h>
-#include <asm-xen/xen-public/dom0_ops.h>
-#include <asm-xen/xen-public/io/domain_controller.h>
-#include <asm/ptrace.h>
-#include <asm/page.h>
-#if defined(__i386__)
-# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-#  ifdef CONFIG_X86_PAE
-#   include <asm-generic/pgtable-nopud.h>
-#  else
-#   include <asm-generic/pgtable-nopmd.h>
-#  endif
-# else
-#  define pud_t pgd_t
-# endif
-#endif
-
-/* arch/xen/i386/kernel/setup.c */
-extern start_info_t *xen_start_info;
-
-/* arch/xen/kernel/evtchn.c */
-/* Force a proper event-channel callback from Xen. */
-void force_evtchn_callback(void);
-
-/* arch/xen/kernel/process.c */
-void xen_cpu_idle (void);
-
-/* arch/xen/i386/kernel/hypervisor.c */
-void do_hypervisor_callback(struct pt_regs *regs);
-
-/* arch/xen/i386/kernel/head.S */
-void lgdt_finish(void);
-
-/* arch/xen/i386/mm/hypervisor.c */
-/*
- * NB. ptr values should be PHYSICAL, not MACHINE. 'vals' should be already
- * be MACHINE addresses.
- */
-
-void xen_pt_switch(unsigned long ptr);
-void xen_new_user_pt(unsigned long ptr); /* x86_64 only */
-void xen_load_gs(unsigned int selector); /* x86_64 only */
-void xen_tlb_flush(void);
-void xen_invlpg(unsigned long ptr);
-
-#ifndef CONFIG_XEN_SHADOW_MODE
-void xen_l1_entry_update(pte_t *ptr, pte_t val);
-void xen_l2_entry_update(pmd_t *ptr, pmd_t val);
-void xen_l3_entry_update(pud_t *ptr, pud_t val); /* x86_64/PAE */
-void xen_l4_entry_update(pgd_t *ptr, pgd_t val); /* x86_64 only */
-void xen_pgd_pin(unsigned long ptr);
-void xen_pgd_unpin(unsigned long ptr);
-void xen_pud_pin(unsigned long ptr); /* x86_64 only */
-void xen_pud_unpin(unsigned long ptr); /* x86_64 only */
-void xen_pmd_pin(unsigned long ptr); /* x86_64 only */
-void xen_pmd_unpin(unsigned long ptr); /* x86_64 only */
-void xen_pte_pin(unsigned long ptr);
-void xen_pte_unpin(unsigned long ptr);
-#else
-#define xen_l1_entry_update(_p, _v) set_pte((_p), (_v))
-#define xen_l2_entry_update(_p, _v) set_pgd((_p), (_v))
-#define xen_pgd_pin(_p)   ((void)0)
-#define xen_pgd_unpin(_p) ((void)0)
-#define xen_pte_pin(_p)   ((void)0)
-#define xen_pte_unpin(_p) ((void)0)
-#endif
-
-void xen_set_ldt(unsigned long ptr, unsigned long bytes);
-void xen_machphys_update(unsigned long mfn, unsigned long pfn);
-
-#ifdef CONFIG_SMP
-#include <linux/cpumask.h>
-void xen_tlb_flush_all(void);
-void xen_invlpg_all(unsigned long ptr);
-void xen_tlb_flush_mask(cpumask_t *mask);
-void xen_invlpg_mask(cpumask_t *mask, unsigned long ptr);
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-/* 
-** XXX SMH: 2.4 doesn't have percpu.h (or support SMP guests) so just 
-** include sufficient #defines to allow the below to build. 
-*/
-#define DEFINE_PER_CPU(type, name) \
-    __typeof__(type) per_cpu__##name
-
-#define per_cpu(var, cpu)           (*((void)cpu, &per_cpu__##var))
-#define __get_cpu_var(var)          per_cpu__##var
-#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
-
-#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
-#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
-#endif /* linux < 2.6.0 */
-
-void xen_create_contiguous_region(unsigned long vstart, unsigned int order);
-void xen_destroy_contiguous_region(unsigned long vstart, unsigned int order);
-
-#include <asm/hypercall.h>
-
-#if defined(CONFIG_X86_64)
-#define MULTI_UVMFLAGS_INDEX 2
-#define MULTI_UVMDOMID_INDEX 3
-#else
-#define MULTI_UVMFLAGS_INDEX 3
-#define MULTI_UVMDOMID_INDEX 4
-#endif
-
-static inline void
-MULTI_update_va_mapping(
-    multicall_entry_t *mcl, unsigned long va,
-    pte_t new_val, unsigned long flags)
-{
-    mcl->op = __HYPERVISOR_update_va_mapping;
-    mcl->args[0] = va;
-#if defined(CONFIG_X86_64)
-    mcl->args[1] = new_val.pte;
-    mcl->args[2] = flags;
-#elif defined(CONFIG_X86_PAE)
-    mcl->args[1] = new_val.pte_low;
-    mcl->args[2] = new_val.pte_high;
-    mcl->args[3] = flags;
-#else
-    mcl->args[1] = new_val.pte_low;
-    mcl->args[2] = 0;
-    mcl->args[3] = flags;
-#endif
-}
-
-static inline void
-MULTI_update_va_mapping_otherdomain(
-    multicall_entry_t *mcl, unsigned long va,
-    pte_t new_val, unsigned long flags, domid_t domid)
-{
-    mcl->op = __HYPERVISOR_update_va_mapping_otherdomain;
-    mcl->args[0] = va;
-#if defined(CONFIG_X86_64)
-    mcl->args[1] = new_val.pte;
-    mcl->args[2] = flags;
-    mcl->args[3] = domid;
-#elif defined(CONFIG_X86_PAE)
-    mcl->args[1] = new_val.pte_low;
-    mcl->args[2] = new_val.pte_high;
-    mcl->args[3] = flags;
-    mcl->args[4] = domid;
-#else
-    mcl->args[1] = new_val.pte_low;
-    mcl->args[2] = 0;
-    mcl->args[3] = flags;
-    mcl->args[4] = domid;
-#endif
-}
-
-#endif /* __HYPERVISOR_H__ */